package com.arvato.minipro.bean.bean_vo.mall;

import java.util.Date;
import java.util.List;

import com.arvato.common.util.ContantFinalUtil;
import com.arvato.common.util.DateFormatUtil;
import com.arvato.common.util.UUIDUtil;

/**
 * @author: smallking
 * 
 * @Descibe:数据库商品表返回给前台json对应的java实体类
 * 
 * @Date: 2018年4月24日 下午2:54:39
 */
public class EcCommodityVo {
	/**
	 * 主键ID
	 */
	private String commodityId = UUIDUtil.getUUID("goods");
	/**
	 * 商品所属商户的userId
	 */
	private String userId;
	/**
	 * 商品名称
	 */
	private String commodityName;
	/**
	 * 商品大图
	 */
	private String commodityBigImg;
	/**
	 * 商品详情图片
	 */
	private String detailImgPath;
	/**
	 * 商品价格
	 */
	private Float price;
	/**
	 * 商品描述
	 */
	private String commodityNote;
	/**
	 * 商品二维码数字
	 */
	private String commodityCode;
	/**
	 * 商品规格
	 */
	private String unit;
	/**
	 * 商品库存数量
	 */
	private Integer count;
	/**
	 * 是否推荐
	 */
	private Integer recommend;
	/**
	 * 是否热卖
	 */
	private Integer hot;
	/**
	 * 是否出售
	 */
	private Integer sale;
	/**
	 * 商品的状态 1：正常； 2；下架等
	 */
	private Integer status;
	/**
	 * 商品的排序码
	 */
	private Integer sortCode;
	/**
	 * 商品图片集合
	 */
	private List<CommodityImgVo> commodityImgList; 
	/**
	 * 商品图片预览路径
	 */
	private String imgViewPath;
	/**
	 * 创建时间
	 */
	private Date createTime;
	/**
	 * 更新时间
	 */
	private Date updateTime;
	/**
	 * 商品分类列表
	 */
	private List<EcCategoryVo> categoryVoList;

	private String categoryId;
	
	private String categoryName;
	/**
	 * 标志商品是否已经被加入砍价
	 */
	private boolean cut;
	/**
	 * 当cut为true的时候
	 * commodityCutId代表当前商品正在进行的砍价规则
	 */
	private String commodityCutId;
	
	public String getCommodityId() {
		return commodityId;
	}

	public void setCommodityId(String commodityId) {
		this.commodityId = commodityId;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getCommodityName() {
		return commodityName;
	}

	public void setCommodityName(String commodityName) {
		this.commodityName = commodityName;
	}

	public String getCommodityBigImg() {
		try {
			return ContantFinalUtil.IMG_PATH + "?fileName=" + commodityBigImg;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

	public void setCommodityBigImg(String commodityBigImg) {
		this.commodityBigImg = commodityBigImg;
	}

	public String getDetailImgPath() {
		try {
			return ContantFinalUtil.IMG_PATH + "?fileName=" + detailImgPath;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
	
	public String getDetailPath() {
		return detailImgPath;
	}

	public void setDetailImgPath(String detailImgPath) {
		this.detailImgPath = detailImgPath;
	}

	public Float getPrice() {
		return price;
	}

	public void setPrice(Float price) {
		this.price = price;
	}

	public String getCommodityNote() {
		return commodityNote;
	}

	public void setCommodityNote(String commodityNote) {
		this.commodityNote = commodityNote;
	}

	public String getCommodityCode() {
		return commodityCode;
	}

	public void setCommodityCode(String commodityCode) {
		this.commodityCode = commodityCode;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public Integer getRecommend() {
		return recommend;
	}

	public void setRecommend(Integer recommend) {
		this.recommend = recommend;
	}

	public Integer getHot() {
		return hot;
	}

	public void setHot(Integer hot) {
		this.hot = hot;
	}

	public Integer getSale() {
		return sale;
	}

	public void setSale(Integer sale) {
		this.sale = sale;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getSortCode() {
		return sortCode;
	}

	public void setSortCode(Integer sortCode) {
		this.sortCode = sortCode;
	}

	public List<CommodityImgVo> getCommodityImgList() {
		return commodityImgList;
	}

	public void setCommodityImgList(List<CommodityImgVo> commodityImgList) {
		this.commodityImgList = commodityImgList;
	}

	public String getImgViewPath() {
		if(commodityImgList != null && commodityImgList.size() >= 1){
			return commodityImgList.get(0).getImgViewPath();
		}
		return imgViewPath;
	}

	public void setImgViewPath(String imgViewPath) {
		this.imgViewPath = imgViewPath;
	}

	public String getCreateTime() {
		return DateFormatUtil.date2Str(createTime);
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getUpdateTime() {
		return DateFormatUtil.date2Str(updateTime);
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public List<EcCategoryVo> getCategoryVoList() {
		return categoryVoList;
	}

	public void setCategoryVoList(List<EcCategoryVo> categoryVoList) {
		this.categoryVoList = categoryVoList;
	}

	public String getCategoryId() {
		if(categoryVoList != null && categoryVoList.size() != 0) {
			String categoryId = categoryVoList.get(0).getCategoryId();
			return categoryId;
		}
		return categoryId;
	}

	public void setCategoryId(String categoryId) {
		this.categoryId = categoryId;
	}

	public String getCategoryName() {
		if(categoryVoList != null && categoryVoList.size() != 0) {
			return categoryVoList.get(0).getCategoryName();
		}
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public boolean isCut() {
		return cut;
	}

	public void setCut(boolean cut) {
		this.cut = cut;
	}

	public String getCommodityCutId() {
		return commodityCutId;
	}

	public void setCommodityCutId(String commodityCutId) {
		this.commodityCutId = commodityCutId;
	}
	
}